# coding: utf-8
from kafka import KafkaProducer
import csv
import time,random

producer = KafkaProducer(bootstrap_servers='cheng:9092')

for line in range(1,10000000):
    gender = random.randint(0, 2)
    num = random.randint(1, 10)
    genders = str(gender) + ',' + str(num)
    print('生产的数据为:'+ genders)
    time.sleep(1)
    producer.send('result',genders.encode('utf8'))


# kafka + 生产 + spark 处理 + kafka +  flask/socketIO  || 报表工具
